home *** CD-ROM | disk | FTP | other *** search
- property hotSprites, active, rollActions, rollOnActions, downActions, statusMessage, destination, clickSound, killList
-
- on new me, paramList
- set killList to []
- set rollActions to []
- set rollOnActions to []
- set downActions to []
- set hotSprites to getProp(paramList, #hotSprites)
- if not voidp(getaProp(paramList, #statusMessage)) then
- set statusMessage to NewObject(me, "Status Display Class", paramList)
- end if
- set destination to getaProp(paramList, #destination)
- set clickSound to getaProp(paramList, #clickSound)
- if not voidp(clickSound) then
- if clickSound > 0 then
- set clickSound to NewObject(me, "Sound FX Class", [#audioMember: clickSound])
- end if
- else
- set clickSound to NewObject(me, "Sound FX Class", [#audioMember: "ugpMouseClick"])
- end if
- if voidp(destination) then
- set destination to 0
- end if
- set active to 0
- return me
- end
-
- on AddRoll me, action
- append(rollActions, action)
- end
-
- on AddRollOnce me, action
- append(rollOnActions, action)
- end
-
- on AddDown me, action
- append(downActions, action)
- end
-
- on CheckRoll me, spritenum, lineNum
- if getPos(hotSprites, spritenum) then
- if objectp(statusMessage) then
- TurnOn(statusMessage)
- end if
- repeat with action in rollActions
- TurnOn(action, spritenum, lineNum)
- end repeat
- if not active then
- repeat with action in rollOnActions
- put "Roll On action:" && rollOnActions
- TurnOn(action, spritenum, lineNum)
- end repeat
- end if
- set active to 1
- return 1
- else
- if objectp(statusMessage) then
- TurnOff(statusMessage)
- end if
- repeat with action in rollActions
- TurnOff(action, spritenum, lineNum)
- end repeat
- repeat with action in rollOnActions
- TurnOff(action, spritenum, lineNum)
- end repeat
- set active to 0
- return 0
- end if
- end
-
- on CheckDown me, spritenum, lineNum
- if getPos(hotSprites, spritenum) then
- put "CheckDown:" && spritenum
- if objectp(clickSound) then
- TurnOn(clickSound)
- end if
- repeat with action in downActions
- put "====> " & action
- TurnOn(action, spritenum, lineNum)
- end repeat
- return destination
- else
- return -1
- end if
- end
-
- on IsClickable me
- return (count(downActions) > 0) or (destination > 0)
- end
-
- on ShowedMessage me
- return objectp(statusMessage)
- end
-
- on dispose me
- set rollActions to 0
- set rollOnActions to 0
- set downActions to 0
- set hotSprites to 0
- set destination to 0
- ClearObjectList(killList)
- set killList to []
- end
-